package com.packet.service.impl;

public class ClientDemo {
    public static void main(String[] args) {
        TeacherBelong top = new TeacherBelong(1, "总学院");
        TeacherBelong top1 = new TeacherBelong(2, "王老师");
        Group group1 = new Group(4, "分组1");
        Group group2 = new Group(5, "分组2");
        TeacherBelong top2 = new TeacherBelong(2, "李老师");
        Group group3 = new Group(6, "分组3");
        Group group4 = new Group(7, "分组4");
        TeacherBelong top3 = new TeacherBelong(3, "樊老师");
        Group group5 = new Group(8, "分组5");
        Group group6 = new Group(9, "分组6");

        top1.add(group1);
        top1.add(group2);

        top2.add(group3);
        top2.add(group4);

        top3.add(group5);
        top3.add(group6);

        top.add(top1);
        top.add(top2);
        top.add(top3);

        Integer level = 0;
        printFolder(top, level);

    }

    public static void printFolder(TeacherBelong folder, Integer level) {
        String space = "";
        for (int i = 0; i < level; i++) {
            space += "  ";
        }
        System.out.println(space + folder.Tname);
        for (Teacher item : folder.getChildren()) {
            if (item instanceof Group) {
                Integer l = level + 1;
                printFolder((TeacherBelong) item, l);
            } else if (item instanceof Group) {
                String p = space + "  ";
                System.out.println(p + item.Tname);
            }
        }
    }


}
